﻿@using EpiInfoCloudMagpiBridge.Models
@model IEnumerable<EpiInfoCloudMagpiBridge.MagpiAccountSetting>

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
@using (Html.BeginForm("Create", "MagpiAccountSettings", FormMethod.Post, Model))
{
    <body>
        <h3>Manage Magpi Credentials  </h3>
        <hr />
        <table class="table">
            <tr>
                <th>
                    @Html.DisplayNameFor(model => model.EWAVUserID)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.MagpiAccessToken)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.MagpiUsername)
                </th>
                <th></th>
            </tr>

            @foreach (var item in Model  )    
            {
                if (item.EWAVUserID == ApplicationModel.CurrentEwavUserId)
                {

                    <tr>
                        <td>
                            @Html.DisplayFor(modelItem => item.EWAVUserID)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.MagpiAccessToken)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.MagpiUsername)
                        </td>
                        <td>
                            @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
                            @*@Html.ActionLink("Details", "Details", new { id = item.Id }) |*@
                            @Html.ActionLink("Delete", "Delete", new { id = item.Id })
                        </td>
                    </tr>
                }
            }

        </table>
    <table>
    <tr>
        <td>
            @Html.ActionLink("Create New Record", "Create")
            @*<button class="btn btn-primary">Add new</button>*@
        </td>
    </tr>
</table>

    </body>
}
</html>
